import React from 'react'
import { Navigate } from 'react-router-dom'
import { storage } from '../utils'

const { getItem } = storage

export const RouterAuth = ({ children }) => {
  const token = getItem('token')
  if (!token) {
    return <Navigate to="/login"></Navigate>
  }

  return children
}
